import{reqAddressInfo,reqOrderInfo}from '@/api/index'
const actions={
  async getUserAddress(context){
    let result=await reqAddressInfo()
    if(result.code=200){
        context.commit('GETUSERADDRESS',result.data)
    }
   },
   async getOrderInfo(context){
    let result =await reqOrderInfo()
    if(result.code==200){
        context.commit('GETORDERINFO',result.data)
    }
   }
};
const mutations ={
    GETUSERADDRESS(state,addressInfo){
        state.addressInfo=addressInfo
    },
    GETORDERINFO(state,orderInfo){
       state.orderInfo=orderInfo
    }
}
const state ={
    addressInfo:[],
    orderInfo:{}
}
const getters={
    addressInfo(state){
    return state.addressInfo
    },
    orderInfo(state){
        return state.orderInfo
    }
}
export default{
    actions,mutations,state,getters
}